<script type="text/html" template>
	<link rel="stylesheet" href="./res/style/aliplayer-min.css?v={{ layui.admin.v }}" media="all">
</script>

<div class="layui-layout layui-layout-admin">
	<div class="layui-header" style="text-align: center;">
		<!-- 头部区域 -->

		<div class="" style="padding: 11px 0 0 30px; text-align: center;">
			<h3 style="font-size: 18px;" id="userName">集训展示系统</h3>
		</div>

	</div>

	<div class="layui-fluid" style="margin-top: 40px;">
		<div class="layui-fluid lay-blog">
			<div class="layui-row">
				<div class="prism-player" id="player-con"></div>
			</div>
			<div class="layui-row">
				<div id="Detail"></div>
			</div>

			<!-- Footer -->
			<div class="foot">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
		</div>
	</div>
</div>
<script type="text/html" id="ProblemDetail">
	<div class="item-title ">
		<p>{{d.SectionName}}</p>
	</div>
	<div class="item-title ">
		<div class="layui-row">
			<div class="layui-col-md9">
			<p>

					{{#  if(d.EnclosureUrl.length >0){ }}
					<a href='EnclosureView.aspx?PID={{d.EnclosureUrl}}' target="_blank"><i class="layui-icon layui-icon-link"></i>查看学习资料</a>
					{{#  } else { }}
					无附件
					{{#  } }}
			<p>
			</div>
			<div class="layui-col-md3">
				{{#  if(layui.router().search.orderID!=1){ }}
				<button class="layui-btn layui-btn-normal" lay-href="video/VideoPlay/CurriculumID=1/orderID={{Number(layui.router().search.orderID)-1}}">上一集</button>
				{{#  } }}
				<button class="layui-btn layui-btn-normal" lay-href="video/VideoPlay/CurriculumID=1/orderID={{Number(layui.router().search.orderID)+1}}">下一集</button>
			</div>
	
		</div>
	</div>
</script>
<script>
	layui.use(['admin', 'layer', 'Aliplayer', 'fileServiceApi'], async function () {
		var $ = layui.$,
			admin = layui.admin,
			layer = layui.layer,
			router = layui.router(),
			view = layui.view,
			Aliplayer = layui.Aliplayer;
		var id = layui.router().search.id;

		var fileServiceApi = layui.fileServiceApi;

		var review = function (data) {
			var windowHeight = window.innerHeight - 100
			if (windowHeight < 500) {
				windowHeight = 500
			}
			windowHeight += "px";
			$('#userName').text(data.studentName);
			var player = new Aliplayer({
				"id": "player-con",
				"source": "/video/" + data.fileUrl,
				//"source": "/v/out/" + data.VideoId + "/index.m3u8",
				//	"format": "mp4",
				"mediaType": "video",
				"width": "100%",
				"height": windowHeight,
				"autoplay": false,
				"isLive": false,
				"rePlay": false,
				"playsinline": true,
				"preload": true,
				"controlBarVisibility": "hover",
				"useH5Prism": true
			}, function (player) {
				console.log("The player is created");
			});
			player.on('ended', function () {

			});
		}
		re = await fileServiceApi.getVideoInfo(id)

		review(re.data);



	});
</script>